//
//  UIScrollView+EdgeBack.m
//  tasker
//
//  Created by yangming on 2017/6/6.
//  Copyright © 2017年 BT. All rights reserved.
//

#import "UIScrollView+EdgeBack.h"

@implementation UIScrollView (EdgeBack)

// 此方法返回YES时，手势事件会一直往下传递，不论当前层次是否对该事件进行响应
- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer {
    // 首先判断otherGestureRecognizer是不是系统pop手势
    if ([otherGestureRecognizer.view isKindOfClass:NSClassFromString(@"UILayoutContainerView")]) {
        // 判断系统手势的state scrollView 的位置是不是正好在最左边 otherGestureRecognizer.state == UIGestureRecognizerStateBegan && 
        if (self.contentOffset.x == 0) {
            
            return YES;
        }
    }

    return NO;
}

@end
